package itcast.web.servlet;

import itcast.service.NoticeService;
import itcast.service.impl.NoticeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delNoticeServlet")
public class DelNoticeServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //获取notice_id
String notice_id=request.getParameter("id");
        NoticeService service=new NoticeServiceImpl();
        service.delNotice(notice_id);
        //转换到/noticelistServlet
        response.sendRedirect(request.getContextPath()+"/noticelistServlet");

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request,response);
    }
}
